package Sync
{
	import logic.GameLogic;
	
	public class SyncSystem extends SyncSystemBase
	{
		public function SyncSystem()
		{
		}
		
		private static var s_ins:SyncSystem = null;
		public static function getInstance():SyncSystem
		{
			if (s_ins == null)
			{
				s_ins = new SyncSystem();
			}
			
			return s_ins;
		}
		
		public function beginInstruct(sender:uint, receiver:uint, instruct:uint):Stream //如何设置此函数只能被一部分类可见
		{
			beginSendMsg(ConstValue.MSG_ID_SYNC);
			stream.writeInt(ConstValue.POINT);
			
			stream.writeInt(sender);
			stream.writeInt(receiver);
			stream.writeInt(instruct);
			stream.writeInt(ConstValue.zeroInstructDataSize);
			
			return stream;
		}
		
		public function endInstruct():Boolean
		{
			
			buffer.position = 28;
			buffer.writeInt(buffer.length - 32);
			
			return endSendMsg();
		}
	}
}